package file

import (
	"strings"

	"github.com/gogf/gf/v2/text/gstr"
)

var File file

type file struct{}

func (r *file) FormatPath(path string, trimBackslash ...bool) string {
	path = gstr.Trim(path)
	if path == "" {
		return path
	}

	path = gstr.Replace(path, "\\", "/")
	if len(trimBackslash) > 0 {
		path = strings.Trim(path, "/")
	}

	return path
}
